package MovieGuessingGame.confirmRegistration;

import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
import java.io.BufferedReader;
import java.io.IOException;

public class ConfirmServerSSL {
	BufferedReader bufferedreader = null;
	SSLServerSocket sslserversocket = null;
	SSLSocket sslsocket = null;
	private String dbPass;          // K1ck1ForMe
	
	void init() throws IOException{
		SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory
				.getDefault();
		sslserversocket = (SSLServerSocket) sslserversocketfactory
				.createServerSocket(30500);
		
		for (;;){
			ConfirmSSLWorker  worker = new ConfirmSSLWorker(this,(SSLSocket)sslserversocket.accept(),dbPass);
			worker.start();
		}
	}

	public static void main(String[] args) {
		try {
			ConfirmServerSSL server = new ConfirmServerSSL();
			server.parseArguments(args);
			server.init();
			
		} catch (Exception exception) {
			exception.printStackTrace();
		}
	}
	private void parseArguments(String[] args)
	 {
	     if (args.length > 0) {
	         if (args[0].length() > 0) {
	        	 dbPass = args[0];
	         }
	     }
	 }
}